<?php
$arr = [1, 2, 3, 4, 5, 6, 7, [70, 71, 72, [111, 222, 333]]];
echo '<pre>';
//print_r($arr);

function search($value, $arr) {
    static $key = [];
    foreach ($arr as $k => $v) {
        if (is_array($v)) {
            $key[] = $k;
            return search($value, $v);
        } elseif ($v === $value) {
            $key[] = $k;
            return $key;
        }
    }
}

//echo search(70, $arr); //[7][0]
//echo $arr[7][0], '<br>';

print_r(search(333, $arr)); //$arr[7][3][2]
echo '<br>';
echo $arr[7][3][2], '<br>';
